import { GoodsRecord } from "@/views/goods/GoodsList/GoodsListType";
import { PageParams } from "./common";

export interface GetGoodsReq extends Partial<PageParams> {
	ids?: string[];
	id?: string;
	name?: string;
	category?: number;
}
export type Spu = Record<string, { name: string; image: string | null }[]>;
export interface SkuAttribute {
	key: string;
	value: { name: string; image: string | null };
}
export type Sku = {
	name: string;
	spu_id?: number;
	detail: string | null;
	price: number;
	originalPrice: number;
	stock: number;
	images: string[] | null;
	attributes: SkuAttribute[];
}[];
export interface CreateGoodsReq {
	name: string;
	cover?: string;
	description?: string;
	status?: number;
	spu?: Spu;
	category?: number[];
	sku?: Sku;
}
export interface Category {
	_id: string;
	name: string;
	cover: string;
	createdTime: string;
	updatedTime: string;
	spu_id: number;
}
export interface UpdateGoodsReq extends Partial<Omit<GoodsRecord, "category" | "updatedTime" | "createdTime">> {
	id: number;
	category?: number[];
}
export interface DeleteGoodsReq {
	id: string;
}
export interface FormatHTMLReq {
    code: string;
}
export type FormatHTMLResp = string;